package General;

import java.io.Serializable;

public class Product implements Serializable {
	
	private static final long serialVersionUID = 1L;
	public final static int GROUND = 1;
	public final static int AIR = 2;
	public final static int AIR_PRIORITY = 3;
	public static int PRODUCT_ID = 1;
	
	public final static int REQUESTED = 1;
	public final static int READY = 2;
	public final static int SENT = 3;
	public final static int ARRIVED = 4;
	public final static int FINISHED = 5;
	
	private int fId;
	private String fSourceAddress;
	private String fDestinationAddress;
	private int fWeight;
	private String fName;
	private int fHeight;
	private int fLength;
	private int fWidth;
	private int fValue;
	private String fCurrency;
	private boolean fHazardous;
	private int fShippingType;
	
	public Product(String name, int weight, String sourceAddress, String destinationAddress, int height, int length, int width, int value, String currency, boolean hazardous, int shippingType) {
		fName = name;
		fWeight = weight;
		fSourceAddress = sourceAddress;
		fDestinationAddress = destinationAddress;
		fHeight = height;
		fLength = length;
		fWidth = width;
		fValue = value;
		fCurrency = currency;
		setfHazardous(hazardous);
		setfShippingType(shippingType);
		fId = PRODUCT_ID;
		PRODUCT_ID++;
	}
	
	public int getWeight() {
		return fWeight;
	}
	
	public String getName() {
		return fName;
	}
	
	public int getId() {
		return fId;
	}

	public String getfSourceAddress() {
		return fSourceAddress;
	}

	public void setfSourceAddress(String fSourceAddress) {
		this.fSourceAddress = fSourceAddress;
	}

	public String getfDestinationAddress() {
		return fDestinationAddress;
	}

	public void setfDestinationAddress(String fDestinationAddress) {
		this.fDestinationAddress = fDestinationAddress;
	}

	public int getfHeight() {
		return fHeight;
	}

	public void setfHeight(int fHeight) {
		this.fHeight = fHeight;
	}

	public int getfLength() {
		return fLength;
	}

	public void setfLength(int fLength) {
		this.fLength = fLength;
	}

	public int getfWidth() {
		return fWidth;
	}

	public void setfWidth(int fWidth) {
		this.fWidth = fWidth;
	}

	public int getfValue() {
		return fValue;
	}

	public void setfValue(int fValue) {
		this.fValue = fValue;
	}

	public String getfCurrency() {
		return fCurrency;
	}

	public void setfCurrency(String fCurrency) {
		this.fCurrency = fCurrency;
	}

	public boolean isfHazardous() {
		return fHazardous;
	}

	public void setfHazardous(boolean fHazardous) {
		this.fHazardous = fHazardous;
	}

	public int getfShippingType() {
		return fShippingType;
	}

	public void setfShippingType(int fShippingType) {
		this.fShippingType = fShippingType;
	}
	
	public static String getShippingTimeName(int shippingType) {
		switch (shippingType) {
			case GROUND:
				return "Ground";
			case AIR:
				return "Air";
			case AIR_PRIORITY:
				return "Air-priority";
			default:
				return "";
		}
	}
	
	public static String getStateName(int state) {
		switch (state) {
			case REQUESTED:
				return "Requested";
			case READY:
				return "Ready";
			case SENT:
				return "Sent";
			case ARRIVED:
				return "Arrived";
			case FINISHED:
				return "Finished";
			default:
				return "";
		}
	}
}
